# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        博智科技  
# Name:         demo1051.1
# Description:
# Author:       yzl
# Date:         2019-02-07
#-------------------------------------------------------------------------------

class Fibonacci:
    def __init__(self):
        self.a = 0
        self.b = 1

    def __next__(self):
        result = self.a
        self.a,self.b = self.b,self.a + self.b

        if result > 500: raise StopIteration
        return result

    def __iter__(self):
        return self


fibs = Fibonacci()
print(list(fibs))
fibs2 = Fibonacci()

for fib in fibs2:
    print(fib,end = " ")
    # if fib > 500:
    #     break

